package zcw.com.lib_leet_code;

import zcw.com.lib_leet_code.bean.ListNode;
import zcw.com.lib_leet_code.util.Util;

/**
 * Created by 朱城委 on 2021/7/13.<br><br>
 *
 * 删除链表中的节点
 */
public class Topic237 {
    public static void main(String[] args) {
        Topic237 instance = new Topic237();

        int[] array = new int[] {4,5,1,9};
        ListNode head = Util.createList(array);
        ListNode node = head.next;
        instance.deleteNode(node);
        Util.printList(head);
    }

    public void deleteNode(ListNode node) {
        node.val = node.next.val;
        node.next = node.next.next;
    }
}
